package com.itheima.stock.controller;

import com.itheima.stock.service.UseService;
import com.itheima.stock.vo.req.LoginReqVo;
import com.itheima.stock.vo.resp.LoginRespVo;
import com.itheima.stock.vo.resp.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/api")
public class UserController {

    @Autowired
    private UseService useService;

    @PostMapping("/login")
    public R<LoginRespVo> login(@RequestBody LoginReqVo vo){
        R<LoginRespVo> r = useService.login(vo);
        return r;
    }

    @GetMapping("/captcha")
    public R<Map> generateCaptcha(){
        return useService.generateCaptcha();
    }

//    @GetMapping("/text")
//    public String getName(){
//        return "itheima";
//    }
}
